/**
 * 
 */
package com.android.supr;

import android.app.Activity;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.webkit.WebView.FindListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class TileAdapter extends BaseAdapter {
	private Activity activity;

	public TileAdapter(Activity activity) {
		super();
		this.activity = activity;

	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return 20;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	public static class ViewHolder {

		public TextView gymName;
		public TextView localityText;
		public TextView discountText;
		
		public TextView gPassName;
		public TextView amount;
		public LinearLayout   gymImage;
	
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
	ViewHolder view;
		LayoutInflater inflator = activity.getLayoutInflater();

		if (convertView == null) {
			view = new ViewHolder();
			convertView = inflator.inflate(R.layout.tile,parent, false);
			view.gymImage = (LinearLayout) convertView
					.findViewById(R.id.gym_image);
		
			view.amount = (TextView) convertView.findViewById(R.id.amount);
			view.gPassName = (TextView) convertView
					.findViewById(R.id.gpass_name);
			view.gymName = (TextView) convertView.findViewById(R.id.gym_name);

			view.localityText = (TextView) convertView
					.findViewById(R.id.locality);
		

			view.discountText = (TextView) convertView
					.findViewById(R.id.discount);

			convertView.setTag(view);
		} else {
			view = (ViewHolder) convertView.getTag();
		}
		view.gymImage.setBackgroundResource(R.drawable.sample_3);

		view.gymName.setText("Workouts");
		view.localityText.setText("Sindhi Colony");

		view.gPassName.setText("175 Daily");
		view.discountText.setText("30% off");

		view.amount.setText("Rs. 175");

		((ViewGroup) convertView).setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
		return convertView;
	}

}
